// license
package main

import (
	"fmt"
	"os"
)

var SecreteKey = `some_secrete_key` // 自定义秘钥
var LicensePath = `/etc/license`    // 自定义license文件路径
var MD5Path = `/etc/md5P`           // 自定义md5记录文件路径
var RecordActive = `/etc/recAt`     // 自定义时间记录文件路径
var key = []byte(GetMD5Encode(SecreteKey))

func main() {

	//RegisterMachineCMD()
	if len(os.Args) <= 1 {
		fmt.Println("\nneed params:\n\tget:\t\t获取机器码\n\tverify:\t\tlicense校验\n\tverify+激活码:\t激活码激活\n")
		return
	}

	switch os.Args[1] {
	case "get":
		{
			res, data := GenericMachineCode()
			if !res {
				fmt.Println("err! => ", data)
			} else {
				fmt.Println("The Machine Code is ", data)
			}
		}
	case "verify":
		{
			if len(os.Args) <= 2 {
				//fmt.Println("\ntoo few params:\n\tformat=>file verify active_code")
				//return
				VerifyLicenseFile()
				return
			}
			//
			GenerateLicense(os.Args[2])
			return
		}
	case "machine":
		{
			RegisterMachineCMD()
			return
		}
	case "test":
		{
			fmt.Println("🎇🎇🎇🎇🎇 congratulations this project complete --by sea 🎇🎇🎇🎇🎇")
			return
		}
	case "--help":
		fmt.Println("\nhelp:\n\tget:\t\t获取机器码\n\tverify:\t\tlicense校验\n\tverify+激活码:\t激活码激活\n")
		return
	}
}
